package com.controller;

//import com.entity.BGoods;
//import com.entity.BType;
//import com.entity.table.BGoodsTableDef;
//import com.mybatisflex.core.paginate.Page;
import com.entity.*;
import com.mybatisflex.core.query.QueryWrapper;
//import com.service.ImageService;
//import com.service.impl.BGoodsServiceImpl;
//import com.service.impl.BTypeServiceImpl;
import com.service.*;
import com.service.impl.ImageServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Controller
public class IndexController {
    @Resource
    ImageServiceImpl imageService;
    @Resource
    FoodNewsService foodNewsService;
    @Resource
    ChineseService chineseService;
    @Resource
    WesternService westernService;
    @Resource
    GourmetService gourmetService;
    @Resource
    MakeService makeService;
    @Resource
    XiaochiService xiaochiService;
    @Resource
    IncludingService includingService;
    @Resource
    BbsService bbsService;
    @GetMapping(value = "")
    public String index(Model model){
        try{
            List<Image> imageList = imageService.list();
            model.addAttribute("imageList",imageList);

            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("imageList",imageList);
            model.addAttribute("foodNewsList",foodNewsList);
        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/index";
    }

    @GetMapping(value = "/zhongcan")
    public String zhongcan(Model model){
        try{
            List<Chinese> chineseList= chineseService.list();
            model.addAttribute("chineseList",chineseList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);

        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/zhongcan";
    }

    @GetMapping(value = "/xican")
    public String xican(Model model){
        try{
            List<Western> westernList= westernService.list();
            model.addAttribute("westernList",westernList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);

        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/xican";
    }

    @GetMapping(value = "/liaoli")
    public String liaoli(Model model){
        try{
            List<Gourmet> gourmetList= gourmetService.list();
            model.addAttribute("gourmetList",gourmetList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);

        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/liaoli";
    }

    @GetMapping(value = "/meishizhizuo")
    public String meishizhizuo(Model model){
        try{
            List<Make> makeList= makeService.list();
            model.addAttribute("makeList",makeList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);

        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/meishizhizuo";
    }

    @GetMapping(value = "/xiaochihtml")
    public String xiaochihtml(Model model){
        try{
            List<Xiaochi> xiaochiList= xiaochiService.list();
            model.addAttribute("xiaochiList",xiaochiList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);
        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/xiaochihtml";
    }

    @GetMapping(value = "/mingdian")
    public String mingdian(Model model){
        try{
            List<Including> includingList= includingService.list();
            model.addAttribute("includingList",includingList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);

        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/mingdian";
    }

    @GetMapping(value = "/liuyan")
    public String liuyan(Model model){
        try{
            List<Bbs> bbsList= bbsService.list();
            model.addAttribute("bbsList",bbsList);
            List<FoodNews> foodNewsList = foodNewsService.list();
            model.addAttribute("foodNewsList",foodNewsList);

        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/liuyan";
    }
}
